<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let num = prompt("请输入班级总人数");
      let sum = 0;//总和
       let average=0;//平均值
      for (let i = 1; i <= num; i++) {
        let name = prompt("请输入第" + i + "位同学");
        sum += Number(name);
      }
      average = sum / num;
      console.log("成绩总和:" + sum);
      console.log("平均成绩:" + average);
    </script>
  </body>
</html>
